﻿<navigation:Page x:Class="WebRSSBuilder.Views.ManageFiles" 
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
           xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
           xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                 xmlns:h="clr-namespace:WebRSSBuilder.Helpers"
                 xmlns:datacontrols="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.DataForm.Toolkit"
           mc:Ignorable="d"
           xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
          Height="482" Width="642"
           Title="Manage Files Page" xmlns:riaControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.DomainServices" xmlns:my="clr-namespace:WebRSSBuilder.Web" xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk">
    <UserControl.Resources>
        <riaControls:DomainDataSource  x:Key="FileSource" AutoLoad="True" d:DesignData="{d:DesignInstance my:File, CreateList=true}" Height="0" LoadedData="fileDomainDataSource_LoadedData" Name="fileDomainDataSource" QueryName="GetFilesQuery" Width="0">
            <riaControls:DomainDataSource.DomainContext>
                <my:DomainServiceDB />
            </riaControls:DomainDataSource.DomainContext>
        </riaControls:DomainDataSource>
        <riaControls:DomainDataSource x:Key="RoleSource" AutoLoad="True" d:DesignData="{d:DesignInstance my:aspnet_Roles, CreateList=true}" Height="0" LoadedData="aspnet_RolesDomainDataSource_LoadedData" Name="aspnet_RolesDomainDataSource" QueryName="GetAspnet_RolesQuery" Width="0">
            <riaControls:DomainDataSource.DomainContext>
                <my:DomainServiceDB />
            </riaControls:DomainDataSource.DomainContext>
        </riaControls:DomainDataSource>
        <h:RoleTypeConverter x:Key="RoleConverter" ItemsSource="{StaticResource RoleSource}" />
    </UserControl.Resources>
    <Grid x:Name="LayoutRoot">


        <sdk:DataGrid AutoGenerateColumns="False" IsReadOnly="True" Height="100" HorizontalAlignment="Left" ItemsSource="{Binding Source={StaticResource FileSource}, Path=Data}" Margin="136,48,0,0" Name="fileDataGrid" RowDetailsVisibilityMode="VisibleWhenSelected" VerticalAlignment="Top" Width="400">
            <sdk:DataGrid.Columns>
                <sdk:DataGridTextColumn x:Name="fileIDColumn" Binding="{Binding Path=FileID, Mode=OneWay}" Header="File ID" IsReadOnly="True" Width="SizeToHeader" />
                <sdk:DataGridTextColumn x:Name="fileNameColumn" Binding="{Binding Path=FileName}" Header="File Name" Width="SizeToHeader" />
            </sdk:DataGrid.Columns>
        </sdk:DataGrid>

        <datacontrols:DataForm  AutoEdit="False" ItemsSource="{Binding Source={StaticResource FileSource}, Path=Data, Mode=TwoWay}" Name="datagrid1" AutoGenerateFields="False" Margin="136,155,104,125" Width="Auto" HorizontalAlignment="Left" MinWidth="400" >
                    <StackPanel>
                        <datacontrols:DataField>
                            <TextBox Grid.Column="1" Grid.Row="1" Height="23" HorizontalAlignment="Left" Margin="3" Name="fileNameTextBox" Text="{Binding Path=FileName, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true, TargetNullValue=''}" VerticalAlignment="Center" Width="120" />
                        </datacontrols:DataField>
                        <datacontrols:DataField>
                            <TextBox Grid.Column="1" Grid.Row="2" Height="23" HorizontalAlignment="Left" Margin="3" Name="fileURLTextBox" Text="{Binding Path=FileURL, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true, TargetNullValue=''}" VerticalAlignment="Center" Width="120" />
                        </datacontrols:DataField>
                        <datacontrols:DataField >
                            <ComboBox Name="combobox2" ItemsSource="{Binding Source={StaticResource RoleSource}, Path=Data, Mode=OneWay}" SelectedItem="{Binding Path=RoleID, Mode=TwoWay, Converter={StaticResource RoleConverter}, NotifyOnValidationError=True, ValidatesOnExceptions=True}" DisplayMemberPath="RoleName" SelectedValuePath="RoleId" />
                        </datacontrols:DataField>
                    </StackPanel>
           
        </datacontrols:DataForm>
        <Button Content="Save" Height="23" HorizontalAlignment="Left" Margin="180,12,0,0" Name="button1" VerticalAlignment="Top" Width="75" Command="{Binding Source={StaticResource FileSource}, Path=SubmitChangesCommand}" />
        <Button Content="Cancel" Height="23" HorizontalAlignment="Left" Margin="435,12,0,0" Name="button2" VerticalAlignment="Top" Width="75" Command="{Binding Source={StaticResource FileSource}, Path=RejectChangesCommand}" />
    </Grid>
</navigation:Page>
